import 'package:flutter/services.dart';

class FotileIotPlugin {
  static const MethodChannel _channel = MethodChannel("FotileIotChannel");

  /// 初始化 SDK
  static Future<String?> init(String UserId) async {
    final result = await _channel.invokeMethod('init',{
      "userId": UserId,
    });
    return result;
  }
  static Future<String?> addDeviceByWifi(
      String ssid, String password, String productId, String productType) async {
    return await _channel.invokeMethod("addDeviceByWifi", {
      "ssid": ssid,
      "password": password,
      "productId":productId,
      "productType":productType,

    });
  }

  static Future<String?> destroy() async {
    return await _channel.invokeMethod("destroy");
  }

  static Future<String?> setDebugMode(bool mode) async {
    return await _channel.invokeMethod("setDebugMode", {"mode": mode});
  }

  static Future<String?> stopAddDevice() async {
    return await _channel.invokeMethod("stopAddDevice");
  }

  static Future<String?> setUpSDKTestEnv(bool loginEnv) async {
    return await _channel.invokeMethod("setUpSDKTestEnv", {"loginEnv": loginEnv});
  }

  static Future<String?> setSubDeviceTime(int time) async {
    return await _channel.invokeMethod("setSubDeviceTime", {"time": time});
  }
}
